-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Label): replace isOverflowLabel with variant="overflow" #580
feat(Label): replace isOverflowLabel with variant="overflow" #580
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple comments below, not a blocker for this PR but worth opening a followup issue for.
code: `import { Label } from '@patternfly/react-core'; <Label someOtherProp />` | ||
} | ||
], | ||
invalid: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will require an update to be made either to the renameProps helper or this rule to be more custom, but we should add an invalid test that checks whether an existing variant
prop is replaced or not:
{
code: `import { Label } from '@patternfly/react-core'; <Label isOverflowLabel variant="outline" />`,
output: `import { Label } from '@patternfly/react-core'; <Label variant="overflow" />`,
errors: [{
message: `isOverflowLabel prop for Label has been replaced with variant="overflow"`,
type: "JSXOpeningElement",
}]
},
I'd be fine having this be a followup, though, especially since we can't be sure if consumers would be passing both isOverflowLabel and a variant (since the variant shouldn't have any effect for an overflow label I believe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I think we can do the change right now, I will make this rule more custom
@@ -0,0 +1,17 @@ | |||
### label-remove-isOverflowLabel [(#10037)](https://github.com/patternfly/patternfly-react/pull/10037) | |||
|
|||
isOverflowLabel prop for Label has been replaced with variant="overflow" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to above comment, we should add onto the message here + when an error is thrown: "Running the fix for this rule will replace an existing variant
prop." or something along those lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. @wise-king-sullyman would you prefer having the open PRs updated to add typing, or do that after alpha when we might have more time to?
d271a3e
to
91b73b5
Compare
I updated types on this and the Nav PR to use the types from eslint |
@thatblindgeye ATM I consider typing just a nice to have. After we have the mods for alpha done I would move it up in priority yeah. The types you've added so far look great though Adam! 🔥 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tiny non-blocking nit/comment, this looks great though 🚀
...t-plugin-pf-codemods/src/rules/v6/labelRemoveIsOverflowLabel/label-remove-isOverflowLabel.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
Closes #556